package net.jarang.support;

import java.io.File;
import java.io.IOException;

import freemarker.template.Configuration;
import freemarker.template.DefaultObjectWrapper;
import freemarker.template.Template;

public class FreemakerTemplateUtil {
	public static Template createTemplate(String type) throws IOException {
		Configuration configuration = new Configuration();
		configuration.setDirectoryForTemplateLoading(new File("templates"));
		configuration.setObjectWrapper(new DefaultObjectWrapper());
		Template template = configuration.getTemplate(type + "-template.ftl");
		return template;
	}
}
